<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <title>办公管理系统-修改友情链接</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate"/>
    <meta name="Keywords" content="keyword1,keyword2,keyword3"/>
    <meta name="Description" content="网页信息的描述"/>
    <meta name="Copyright" content="All Rights Reserved."/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/easyUI/easyui.css">
</head>
<body style="background: #F5FAFA;">
<form id="addUserForm" action="" method="post" style="margin-top: 10px;">
    <input name="linksId" id="linksId" value="${friendlinks.sysid}" type="hidden">
    <table class="table-condensed" align="center">
        <tbody>
        <tr>
            <td><label>名称:</label></td>
            <td><input type="text" id="nickname" name="nickname" value="${friendlinks.nickname}" class="form-control" placeholder="请输入链接名称"></td>
        </tr>
        <tr>
            <td><label>博客地址:</label></td>
            <td><input type="text" id="weburl" name="weburl"  value="${friendlinks.weburl}" class="form-control" placeholder="请输入博客地址"></td>
        </tr>
        <tr>
            <td><label>联系方式:</label></td>
            <td><input id="phone" name="phone" type="text" value="${friendlinks.phone}" class="form-control" placeholder="请输入联系方式"></td>
        </tr>
        <tr>
            <td><label>备注:</label></td>
            <td><input id="remark" name="remark" type="text" value="${friendlinks.remark}" class="form-control" placeholder="备注">
            </td>
        </tr>
        </tbody>
    </table>
    <div align="center" style="margin-top: 20px;">
        <a id="btn_submit" class="btn btn-info"><span class="glyphicon glyphicon-plus"></span>&nbsp;添加</a>
        <button type="reset" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span>&nbsp;重置
        </button>
    </div>
</form>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/jquery/jquery.min.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/resources/jquery/jquery-migrate-1.2.1.min.js"></script>
<!-- 导入bootStrap的库 -->
<script type="text/javascript"
        src="${pageContext.request.contextPath}/resources/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/easyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/easyUI/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/layer/2.4/layer.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/resources/plugins/layer/2.4/LayConstant.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/md5.js"></script>
<script type="text/javascript">

    //增加链接
    $("#btn_submit").click(function () {
        var linksId = $("#linksId").val();
        var nickname = $("#nickname").val();
        if ($.trim(nickname) == "") {
            layer.msg("请输入名称!", {icon: 5, time: LayUIConstant.TIP_TIME});
            $("#nickname").focus();
            return;
        }

        var weburl = $("#weburl").val();
        if ($.trim(weburl) == "") {
            layer.msg("请输入博客地址!", {icon: 5, time: LayUIConstant.TIP_TIME});
            $("#weburl").focus();
            return;
        }

        var phone = $("#phone").val();
        var remark = $("#remark").val();


        $.ajax({
            url: '${pageContext.request.contextPath}/friendlinks/submitAddLinks.jspx',
            data: {
                "linksId":linksId,
                "nickname": nickname,
                "weburl": weburl,
                "phone": phone,
                "remark": remark
            },
            type: 'post',
            dataType: 'json',
            success: function (data) {
                if (data.code == 0) {
                    layer.msg(data.message, {icon: 1, time: LayUIConstant.TIP_TIME});
                    setTimeout(function () {
                        parent.location.reload();
                     }, 1500);
                } else {
                    layer.msg(data.message, {icon: 5, time: LayUIConstant.TIP_TIME});
                }
            },
            error: function (data) {
                layer.msg(data.message, {icon: 5, time: LayUIConstant.TIP_TIME});
            }
        });
    });
</script>

</body>
</html>